package com.se.frontline.gameplay;

import org.andengine.entity.Entity;
import org.andengine.entity.scene.IOnSceneTouchListener;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.sprite.Sprite;
import org.andengine.input.touch.TouchEvent;
import org.andengine.input.touch.detector.PinchZoomDetector;

import com.se.frontline.gameplay.levels.Level;
import com.se.frontline.managers.ResourceManager;

public class GameBackground extends Entity {

	private static final float GAME_GROUND_START = (float) (ResourceManager
			.getInstance().cameraHeight * 0.35);

	private Sprite mBackgroundLeftSprite;
	private Sprite mBackgroundRightSprite;

	public GameBackground(Level CurrentLevel) {
		this.setX(0);
		this.setY(0);
		// Create left background sprite
		mBackgroundLeftSprite = new Sprite(0, 0, 800, GAME_GROUND_START,
				ResourceManager.getInstance().mBackgroundLeftTextureRegion,
				ResourceManager.getInstance().engine
						.getVertexBufferObjectManager());
		// Attach left background sprite to the background scene
		this.attachChild(mBackgroundLeftSprite);

		// Create the right background sprite, positioned directly to the right
		// of the first segment
		mBackgroundRightSprite = new Sprite(
				mBackgroundLeftSprite.getX()
						+ ResourceManager.getInstance().mBackgroundLeftTextureRegion
								.getWidth(),
				0, 800, GAME_GROUND_START,
				ResourceManager.getInstance().mBackgroundRightTextureRegion,
				ResourceManager.getInstance().engine
						.getVertexBufferObjectManager());

		// Attach right background sprite to the background scene
		this.attachChild(mBackgroundRightSprite);
	}
}
